import Vue from 'vue'
import VueRouter from 'vue-router'
// 引入路由组件
import Home from '../views/Home.vue'
import User from '../views/User.vue'
import Main from '../views/Main.vue'
import Mall from '../views/Mall.vue'
import pageOne from '@/views/pageOne'
import pageTwo from '@/views/pageTwo'
Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        component: Main,
        redirect: '/home',
        children: [
            {
                // 首页
                name: 'home',
                path: 'Home',
                component: Home
            },
            {
                // 用户管理
                name: 'user',
                path: 'User',
                component: User
            },
            {
                // 商品管理
                name: 'mall',
                path: "Mall",
                component: Mall
            },
            {
                //  页面1
                name: 'page1',
                path: "page1",
                component: pageOne
            },
            //  页面2
            {
                name:'page2',
                path: "page2",
                component: pageTwo
            }
        ]
    }
]

const router = new VueRouter({
    routes
})

export default router
